﻿namespace LiSAClient.Core.Converters
{
    using System;
    using System.Globalization;
    using System.Windows.Data;

    public class SubtractOffsetConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            // Default to 0. 
            double result = 0;

            if (value != null && parameter != null)
            {
                double numerator = (double)value;
                double denominator = double.Parse(parameter.ToString());

                result = numerator - denominator;
            }

            return result;
        }

        public object ConvertBack(
            object value,
            Type targetType,
            object parameter,
            CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}